package onenight.tools.core;

import onenight.tools.debug.GameLogger;
import onenight.tools.user_interface.GameWindowsManager;

import org.andengine.ui.activity.SimpleBaseGameActivity;

import android.os.Bundle;

public abstract class OneNightGameActivity extends SimpleBaseGameActivity {

	private static OneNightGameActivity mInstance;
	
	public static OneNightGameActivity getInstance()
	{
		return mInstance;
	}
	
	@Override
	protected  final void onCreate(Bundle pSavedInstanceState) {
		mInstance = this;
		GameLogger.initialization(this);
		onCreateActivity(pSavedInstanceState);
		super.onCreate(pSavedInstanceState);
	}

	protected abstract void onCreateActivity(Bundle pSavedInstanceState);
	
	@Override
	public final void onBackPressed() {
		GameWindowsManager.getInstance().closeLast();
	}
	
	public boolean onCloseActivity()
	{
		return true;
	}
	
	public final void ImmediatelyCloseActivity()
	{
		System.exit(0);
	}
}
